<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String ctx = request.getContextPath();
	String resources = ctx + "/resources";
%>
<link href='<%=resources%>/insert/css/datetimepicker.css'
	rel='stylesheet'>
<script src="<%=resources%>/insert/js/jquery.datetimepicker.js"></script>
<script type="text/javascript">
	//flag 是全局变量 在back/index.js中定义
	$(".userInfor").attr("id", "userInfor" + flag);
	$(function() {
		UE.getEditor('userInfor' + flag, {
			toolbars : [ [ 'source', 'undo', 'redo', 'bold', 'fontfamily' ] ],
			autoHeightEnabled : true,
			autoFloatEnabled : true,
			initialFrameHeight : 100
		});
	})
	function changePass(para) {
		var html = '<label>密码*</label> <input name="password" type="password"  class="form-control" />';
		$('#' + para).html(html);
		$("."+para).css("display","none");
		$(".cancle-change").css("display","block");
	}
	function cancleChange(para) {
		$("."+para).css("display","block");
		$('#' + para).html('');
		$(".cancle-change").css("display","none");
	}
</script>
<!-- 模态框（Modal） -->
<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">&times;</button>
			<h4 class="modal-title" id="myModalLabel">修改个人信息</h4>
		</div>
		<div class="modal-body">
			<form action="<%=ctx%>/back/user/updateUser.do" method="post">
				<input name="id" value="${user.id }" type="hidden">
				<p>
					<label>帐号*</label> <input name="username" type="text"
						value="${user.username }" class="form-control" />
				</p>
				<p>
					<a href="javascript:changePass('changePass');"
						class="btn btn-default changePass" style="display:block;">修改密码</a>
					<a href="javascript:cancleChange('changePass');"
						class="btn btn-default cancle-change"  style="display:none;">取消修改</a>
				</p>
				<p id="changePass"></p>
				<p>
					<label>姓名*</label> <input name="nickname" type="text"
						value="${user.nickname }" class="form-control" />
				</p>
				<p>
					<label>年龄*</label> <input name="age" type="text"
						value="${user.age }" class="form-control" />
				</p>
				<p>
					<label>性别*</label> <select name="sex" type="text"
						class="form-control">
						<c:if test="${user.sex eq '男' }">
							<option selected="selected">男</option>
							<option>女</option>
						</c:if>
						<c:if test="${user.sex eq '女' }">
							<option>男</option>
							<option selected="selected">女</option>
						</c:if>
					</select>
				</p>
				<p>
					<label>生日*</label> <input name="birthday" type="text"
						value="${user.birthday }" class="form-control  datetime" />
				</p>
				<p>
					<label>个人描述*</label>
					<textarea name="infor" class="userInfor">${user.infor}</textarea>
				</p>
				<p>
					<input name="imageName" type="hidden" value="${user.imageName }" />
				</p>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>
					<button type="submit" class="btn btn-primary">编辑</button>
				</div>
			</form>
		</div>

	</div>
	<!-- /.modal-content -->
</div>
<!-- /.modal -->